home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / AmiVoGL_MDEV.lha / examples / floc.for < prev    next >
Text File  |  1991-06-03  |  1KB  |  88 lines

  1.  
  2. c a routine to demonstrate using locator.
  3. c
  4.     program flocator
  5.  
  6. $INCLUDE: 'fvogl.h'
  7. $INCLUDE: 'fvodevic.h'
  8.  
  9.     integer bt
  10.     integer *2 x, y, sx, sy
  11.     logical act, curpnt
  12.     integer *2 val, vminx, vmaxx, vminy, vmaxy
  13. c
  14. c Note the declaration of the function locator below
  15. c
  16.  
  17.     call winope('floc', 4)
  18.         call getvie(vminx, vmaxx, vminy, vmaxy)
  19.  
  20.     xmin = vminx
  21.     xmax = vmaxx
  22.     ymin = vminy
  23.     ymax = vmaxy
  24.  
  25.         call ortho2(xmin, xmax, ymin, ymax)
  26.  
  27.     call color(BLACK)
  28.     call clear
  29.  
  30.     call color(BLUE)
  31.  
  32. c
  33. c    draw some axes
  34. c
  35.     y = (vmaxy - vminy) / 2
  36.         call move2s(vminx, y)
  37.         call draw2s(vmaxx, y)
  38.  
  39.     x = (vmaxx - vminx) / 2
  40.         call move2s(x, vminy)
  41.         call draw2s(x, vmaxy)
  42.  
  43.     call color(GREEN)
  44.  
  45. c
  46. c    enable the mouse buttons
  47. c
  48.         call unqdev(INPUTC)
  49.         call qdevic(LEFTMO)
  50.         call qdevic(MIDDLE)
  51.  
  52.  
  53.     act = .false.
  54.     curpnt = .false.
  55. c
  56. c    qread waits for a mouse event and getval tells us
  57. c    the valuator's value. In this case it's the X and Y
  58. c    positions of the mouse.    Note: these come back to us in
  59. c    screen coordinates.
  60. c
  61.  
  62. 1    continue
  63.         bt = qread(val)
  64.         sx = getval(MOUSEX)
  65.         sy = getval(MOUSEY)
  66.  
  67.         if (bt .eq. MIDDLE) then
  68.             call gexit
  69.             stop
  70.         else if (act) then
  71.             act = .false.
  72.             call move2s(sx, sy)
  73.             call draw2s(x, y)
  74.         else 
  75.             act = .true.
  76.             x = sx
  77.             y = sy
  78.         end if
  79.  
  80. c                
  81. c               swallow the up event... 
  82.                 bt = qread(val) 
  83.  
  84.     goto 1
  85.  
  86.     end
  87.